<?php	
	function pre_resp($resp){
		$ErrCode = C("ErrCode");
		$SubCode = C("SubCode");
		if($resp->code!==null && is_callable($resp->code->__toString)){
			$code = $resp->code->__toString();
		}
		if($code && $ErrCode[$code]){
			$resp->msg = $ErrCode[$code];
		}
		if($resp->sub_code!==null && is_callable($resp->sub_code)){
			$sub_code = $resp->sub_code->__toString();
		}
		if($code && $SubCode[$sub_code]){
			$resp->sub_msg = $SubCode[$sub_code];
		}
		if(!$code && !$resp->code){
			$resp->code = 200;
		}
		return $resp;
	}